<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
        xmlns:p="http://primefaces.org/ui">
    <h:form>
        <p:remoteCommand name="adicionarCurso" action="#{cursoCtrl.adicionarNovoCurso()}" update=":frmEdicaoCurso" oncomplete="dlgEdicaoCurso.show();" />
        <p:remoteCommand name="editarCurso" update=":frmEdicaoCurso" oncomplete="dlgEdicaoCurso.show();" />
    </h:form>
    
    <p:dialog widgetVar="dlgEdicaoCurso" closable="false" modal="true" header="Dados do Curso" resizable="false" dynamic="true">
        <h:form id="frmEdicaoCurso">
            <p:panelGrid columns="2" rendered="#{cursoCtrl.curso != null}">
                <h:outputLabel value="Código Matriz Curricular:" />
                <p:inputText value="#{cursoCtrl.curso.codigoMatrizCurricular}" />
                <h:outputLabel value="Nome:" />
                <p:inputText value="#{cursoCtrl.curso.nome}" />
            </p:panelGrid>
            
            <p:commandButton action="#{cursoCtrl.salvarCurso()}" value="Salvar" update=":form-principal :form-sidebar" oncomplete="dlgEdicaoCurso.hide();" />
            <p:commandButton action="#{cursoCtrl.cancelarEdicao()}" value="Cancelar" update=":form-principal :form-sidebar" oncomplete="dlgEdicaoCurso.hide();" />
        </h:form>
    </p:dialog>
</ui:composition>